package com.ratta.supernote.note.plugincore.api;


import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;

import com.facebook.react.ReactPackage;
import com.ratta.supernote.note.plugincore.bean.NoteOperateTrails;
import com.ratta.supernote.note.plugincore.callback.NoteDialogListener;
import com.ratta.supernote.note.plugincore.core.PluginAppAPI;
import com.ratta.supernote.note.plugincore.notedata.PenInfo;

import java.util.ArrayList;

/**
 * Abstract class for calling note library, implementation in note main program
 */
public abstract class NoteLibAPI {
    private static NoteLibAPI instance;
    public static NoteLibAPI getInstance(){
        return instance;
    }

    public NoteLibAPI() {
    }

    /// Need to initialize by calling init in Application
    public static void init(NoteLibAPI noteLibAPI) {
        instance = noteLibAPI;
    }

    /// Get RN related Packages
    public abstract ArrayList<ReactPackage> getRNPackages(PluginAppAPI pluginApp);

    /// Modify note file data here
    public abstract void modifyImage(Bitmap bitmap);

    public abstract void deleteImage();

    public abstract void setPenInfo(PenInfo penInfo);

    public abstract void setFullAuto(boolean enable, String tag);

    // Show tip dialog
    public abstract void showTipDialog(Context context, boolean isSuccess, String tip, NoteDialogListener listener);

    /**
     * Save sticker
     * @param trails Strokes to be saved as sticker
     * @param stickerPath Path to save the sticker
     * @return
     */
    public abstract boolean saveSticker(NoteOperateTrails trails, String stickerPath);

    /**
     * Get thumbnail dimensions
     * @param stickerPath
     * @return
     */
    public abstract Rect getStickerRect(String stickerPath);

    /**
     * Generate thumbnail
     * @param stickerPath Sticker path
     * @param thumbnailPath Generated thumbnail path
     * @return
     */
    public abstract boolean generateStickerThumbnail(String stickerPath, String thumbnailPath, int width, int height);


    public abstract boolean convertImage2Sticker(String pngPath, String stickerPath);

    public abstract boolean setSlideBarStatus(Context context, boolean status, String str);
}
